function getParameter(name) {
var url = location.search;
	if (url.indexOf("?") != -1) {
      	var str = url.substr(1);
      	strs = str.split("&");
      	for(var i = 0; i < strs.length; i++) {
        	 if(strs[i].split("=")[0] == name) 
			 	return decodeURI(strs[i].split("=")[1]);
   	    }
	}
	return null;
}
function getCookie(name){
	var str = document.cookie;
	if(!str || str.indexOf(name + "=") < 0)
		return;
	var cookies = str.split("; ");
	for(var i=0; i<cookies.length; i++){
		var cookie = cookies[i];
		if(cookie.indexOf(name + "=") == 0){
			var value = cookie.substring(name.length + 1);
			return decodeURI(value);
		}
	}
}
function setCookie(name, value){
	// document.cookie = name + "=" + encodeURI(value);
    var expires = (arguments.length > 2) ? new Date(arguments[2]) : null;
    var path = (arguments.length > 3) ? arguments[3] : null;
    var domain = (arguments.length > 4) ? arguments[4] : null;
    var secure = (arguments.length > 5) ? arguments[5] : false;
    document.cookie = encodeURI(name) + "=" + encodeURI(value) +
      ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
      ((path == null) ? "" : ("; path=" + path)) +
      ((domain == null) ? "" : ("; domain=" + domain)) +
      ((secure == true) ? "; secure" : "") + ";";
   
}
function deleteCookie(name) {
	var str = document.cookie; 
	var exp = new Date();
	var path = (arguments.length > 1) ? arguments[1] : null;
	exp.setTime(exp.getTime()  -  1);
	if(!str || str.indexOf(name) < 0) 
		return;
	var cookie = encodeURI(name) + "=" + getCookie(name) + ";  expires="+  exp.toGMTString() + ((path == null) ? "" : ("; path=" + path));
	document.cookie = cookie;
}

function getYearCode(){
	var date = new Date();
	var result = "Y";
	var gap=0;
	//var y1 = parseInt(entranceYear);
	var y2 = date.getFullYear();
	var mon = date.getMonth()+1;
	if(mon >= 7){
	   gap = y2-entranceYear+1;
	}else{
	   gap = y2-entranceYear;
	}
	if(gap >= 10){
	   result += gap;
	}else{
	   result += "0"+gap;
	}
	return result;
}

function getYearCodeName(yc){
    var reulst = "";
    switch(yc){
       case 'Y01':
         reulst = "大一";
         break;
       case 'Y02':
         reulst = "大二";
         break;
       case 'Y03':
         reulst = "大三";
         break;
      case 'Y04':
         reulst = "大四";
         break;
      case 'Y05':
         reulst = "大五";
         break;
      case 'Y06':
         reulst = "大六";
         break;
       default:
         reulst = "本科";  
    }
    return reulst;
}